Skip to content

Conversation

@hexoul
Copy link
Collaborator

@hexoul hexoul commented Nov 16, 2025

Motivation:

  • Inspired by the unasync approach successfully used by projects like elasticsearch-py, This PR is the first step toward supporting asyncio clients. (related Support asyncio #2)
    To avoid maintaining two separate, parallel codebases (one for sync, one for async), this PR introduces the unasync build system. This approach allows us to write all client logic as asynchronous code (in centraldogma/_async/) and then automatically generate the synchronous version from that source.
  • This initial PR only sets up the infrastructure and workflow for unasync. No actual client logic (ContentService, Dogma and so on) has been migrated yet. That will be done in follow-up PRs.

Modifications:

  • Build System:
    • Adds unasync as a development dependency.
    • Adds utils/run-unasync.py as the main script to run code generation.
    • Creates the new centraldogma/_async/ directory, which will become the "source of truth" for all async/sync client code.
    • Drop transport-level retries to provide a same behavior between sync and async, and to avoid unexpected double retries.
  • CI:
    • Following the elasticsearch-py strategy, this PR adds a "Check unasync" step to the workflow.
    • This CI check fails if a PR modifies _async/ code but does not also commit the corresponding auto-generated sync code. This ensures the source and generated code are always in sync.
  • Updates CONTRIBUTING.md to explain this new "Code generation" workflow to all contributors. (partially moved from README.md)
  • misc.

Result:

  • BaseClient async and sync codes are maintained using a single file.
  • Improved documentation to contribute.

@hexoul hexoul self-assigned this Nov 16, 2025
@hexoul hexoul marked this pull request as draft November 16, 2025 01:51
@hexoul hexoul changed the title Uses unasync to automatically generate all synchronous client code WIP: Uses unasync to automatically generate all synchronous client code Nov 16, 2025
@hexoul hexoul removed their assignment Nov 16, 2025
@hexoul hexoul changed the title WIP: Uses unasync to automatically generate all synchronous client code Uses unasync to automatically generate all synchronous client code Nov 17, 2025
@hexoul hexoul marked this pull request as ready for review November 17, 2025 08:54
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reasonable approach. 👍👍

Copy link
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

@hexoul hexoul merged commit 16bd29a into line:main Nov 18, 2025
25 checks passed
@hexoul hexoul deleted the feature/async-base-client branch November 20, 2025 05:13
@hexoul hexoul added this to the 0.7.0 milestone Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants